package com.t7;

/**
 * Created by xuyiwei on 2018/7/18.
 */
class Cleaner1{
    private String s = "Cleanser";
    public void append(String a){
        s+= a;
    }

    public void dilute(){
        append(" dilute() ");
    }

    public void apply(){
        append(" apply() ");
    }

    public void scrub(){
        append(" scrub() ");
    }

    @Override
    public String toString() {
        return s;
    }

    public static void main(String[] args) {
        Cleaner1 cleaner = new Cleaner1();
        cleaner.dilute();
        cleaner.apply();
        cleaner.scrub();
        System.out.println(cleaner);
    }
}
class Soap{
    private String s;

    public Soap() {
        System.out.println("Soap()");
        this.s = "Constructed";
    }

    @Override
    public String toString() {
        return "Soap{" +
                "s='" + s + '\'' +
                '}';
    }
}
public class Bath {
    private String s1 = "Happy",s2 = "Happy",s3,s4;
    private Soap soap;
    private int i;
    private float toy;

    public Bath() {
        System.out.println("Inside Bath()");
        s3 = "jony";
        toy = 3.14f;
        soap = new Soap();
    }

    @Override
    public String toString() {
        return "Bath{" +
                "s1='" + s1 + '\'' +
                ", s2='" + s2 + '\'' +
                ", s3='" + s3 + '\'' +
                ", s4='" + s4 + '\'' +
                ", soap=" + soap +
                ", i=" + i +
                ", toy=" + toy +
                '}';
    }

    public static void main(String[] args) {
        Bath bath = new Bath();
        System.out.println(bath);
    }
}
